﻿@using Microsoft.AspNet.Identity
@model IEnumerable<Consumer.Models.ApplicationUser>

@{
    ViewBag.Title = "Users";
}

<h2>@ViewBag.Title</h2>

<p>
    @Html.ActionLink("Create New", "Register", "Account")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.UserName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.FirstName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.LastName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Email)
        </th>
        <th></th>
    </tr>
    @foreach (var item in Model) 
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.UserName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.FirstName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.LastName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Email)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
                @Html.ActionLink("Details", "Details", new { id=item.Id })
                @if (item.Id != User.Identity.GetUserId())
                {
                    <text> | </text>@Html.ActionLink("Delete", "Delete", new { id=item.Id })
                }
            </td>
        </tr>
    }

</table>
